/***********************************************************************
 *
 * MODULE NAME:    host_msg.h
 * DESCRIPTION:    Host Message
 * MAINTAINER:     Tianwq
 *
 * SOURCE CONTROL: $Id: host_msg.h,v 1.1 2008/12/17 10:19:31 jianguo Exp $
 *
 * LICENSE:
 *     This source code is copyright (c) 2010 RDA.
 *     All rights reserved.
 *
 ***********************************************************************/

#ifndef _RDA_HOST_MSG_H_
#define _RDA_HOST_MSG_H_

typedef struct st_rdabt_msg_info_t{
    u_int16 msg_id;
    u_int8 *data;                                     /* parameter with the message */

    /* User API level members end here ... */
    u_int8 dest_id;
    u_int8 source_id;
    u_int8 length;                                          /* length in bytes of data */
} msg_info_t;

/* internal message define */
enum {
    MGR_CONNECT_REQ = 0x1000,
    MGR_CONNECT_CNF,
    MGR_DISCONNECT_IND,
    MGR_ACCESS_REQ,
    MGR_ACCESS_CNF,

    L2CAP_MSG_BASE = 0x2000,

    RFCOMM_MSG_BASE = 0x3000,


   /* user define message, used in internal */
    BT_USER_MSG_BASE = 0xf000
};


typedef struct st_l2cap_data_msg {
    u_int16 handle;
    u_int16 flags;
    rdabt_host_buf_t *pdu;
} l2cap_data_msg_t;

typedef struct st_l2cap_connect_cfm_msg {
    u_int8 result;
    u_int16 handle;
    tid_t tid;
} l2cap_connect_cfm_msg_t;

typedef struct st_mgr_access_cnf {
    u_int32 handle;
    u_int8 direction;
    t_api status;
} mgr_access_cnf_t;


/* non api functions */
void rdabt_message_initialise(void);
void rdabt_message_shutdown(void);
msg_info_t *rdabt_enqueue_message(u_int8 length);
void rdabt_commit_message(void);
msg_info_t *rdabt_get_next_message(void);
void rdabt_free_last_message(void);
u_int8 rdabt_check_message_size(u_int8 count, u_int16 size);

#endif // _RDA_HOST_MSG_H_

